<?php
require_once __DIR__.'/vendor/autoload.php';
require_once __DIR__.'/helper.php';
define('GAME_NAME','xnh5');
define('APP_DEBUG',false);
$database =  new \Tyrone\Lib\SafeMedoo([
    'database_type'     => 'mysql',
    'server'     => '192.168.0.24',
    'port'     => 3306,
    'database_name' => 'xnh5_center',
    'username' => 'root',
    'password' => 'UUWNqc#$5I99#',
    'charset'  => $config['charset'] ?? 'utf8mb4',
    // 注意：关闭持久连接，由连接池管理
    'option'   => [
        \PDO::ATTR_PERSISTENT => false,
        \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
    ],
    //'logging' => true,
    'trace_file' => './test.log',
    'trace_on' => 1,
],null);
$platformList = $database->select('log_center.s_game_db_config','*',[
    'platform' =>'xwhardcore'
]);
foreach ($platformList as $item){
    $database_name = getGameDb($item['platform'],$item['plat_server']);
    $database_name = str_replace('_game_','_admin_s',$database_name);
    /*$game = \Tyrone\Lib\DatabasePool::createStaticConnectionBy($database_name,$item['mysql_host'],$item['mysql_port'],$item['mysql_user'],$item['mysql_pass']);
    $data = $game->get('l_table_max_id','*',[
        'table_name' => 'role'
    ]);
    try{
        $data['platform'] = $item['platform'];
        $data['plat_server'] = $item['plat_server'];
        $data['table_name'] = 'role';
        print_r($data);
        $database->updateOrInsert('log_center.l_table_max_id',$data,[
            'platform',
            'plat_server',
            'table_name',
        ]);
    }catch (Throwable $exception){

    }*/
    $list = $database->select('xnh5_center.c_player_online','*',[
        'platform'=>$item['platform'],
        'plat_server'=>$item['plat_server'],
        'day'=>20250922,
    ]);
    foreach ($list as $one){
        unset($one['id']);
        $database->insert('log_center.c_player_online',$one);
    }

}
/*$list = $database->select('c_day_online','*',[

]);
print_r($list);*/